package com.ykq.system.controller;

import com.baomidou.mybatisplus.core.metadata.IPage;
import com.ykq.common.entity.AclUser;
import com.ykq.common.vo.Result;
import com.ykq.security.annotation.RequiresPermissions;
import com.ykq.system.service.AclUserService;
import com.ykq.system.vo.UserVo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.security.acl.Acl;

/**
 * @program: qy156-education-cloud
 * @description:
 * @author: 闫克起2
 * @create: 2022-12-01 14:56
 **/
@RestController
@RequestMapping("/system/user")
public class AclUserController {
    @Autowired
    private AclUserService userService;

    @GetMapping("/getByName/{username}")
    public Result<AclUser> getName(@PathVariable String username){
        return userService.findByName(username);
    }

    @GetMapping("deleteUserById/{id}")
    @RequiresPermissions(value="user:remove")
    public Result<Void> remove(@PathVariable String id){
        System.out.println("~~~~~~~~~~用户删除~~~~~~~~~~~~~");
        return new Result<>(2000,"删除用户");
    }

    @GetMapping("info")
    public Result<AclUser> info(){

        return userService.findUserinfo();
    }

    @PostMapping("getUserByPage/{current}/{pageSize}")
    public Result<IPage<AclUser>> getUserByPage(@PathVariable(required = true) Integer current, @PathVariable(required =true ) Integer pageSize,
                                                @RequestBody UserVo userVo
                                                ){
            return userService.findByConditionPage(current,pageSize,userVo);
    }
}












